
    var backgroupUI = new Image();
    var mushroomUI = new Image();

    var canvas;
    var canvasWidth;
    var canvasHeight;

    var context;

    var mushroom;

    function GameObject()
    {
        this.x = 0;
        this.y = 0;
        this.image = null;
    }

    function Mushroom() {};
    Mushroom.prototype = new GameObject();



    function gameLoop()
    {
        context.clearRect(0,0,canvasWidth,canvasHeight);
        context.save();
        context.drawImage(backgroupUI,0,0);
        context.drawImage(mushroom.image,mushroom.x,mushroom.y);
        context.restore();
    }

    function loadImage()
    {
        backgroupUI.src = "./picture/moto2.jpg";
        mushroomUI.src = "./picture/mushroom.png";
    }

    function addEventHandlers()
    {
        $("#container").mousemove(function(e)
        {
            mushroom.x = e.offsetX - (mushroom.image.width/2);
            //mushroom.x = e.pageX;
        })
    }

    $(document).ready(function()
    {
        loadImage();
        addEventHandlers();
        canvas = $("#canvas");
        context = canvas.get(0).getContext("2d");
        canvasWidth = canvas.width();
        canvasHeight = canvas.height();

        mushroom = new Mushroom();
        mushroom.x = canvasWidth/2;
        mushroom.y = canvasHeight - mushroomUI.height;
        mushroom.image = mushroomUI;


        setInterval(gameLoop, 33);
    })
